package entities;


public abstract class Creature extends Entity {

	protected int maxHealth;
	protected int currentHealth;

	protected Entity lastAttacker;

	public Creature(int maxHealth) {
		super();
		this.maxHealth = maxHealth;
	}

	public int getHealth() {
		return currentHealth;
	}

	public int getMaxHealth() {
		return maxHealth;
	}
	
	public Entity getLastAttacker() {
		return lastAttacker;
	}

	public void takeDamage(int damage, Entity attacker) {
		currentHealth = Math.max(0, currentHealth - damage);
		if (attacker != null)
			this.lastAttacker = attacker;
	}
	

}
